/*
 * Project: BoboDesignPattern
 * 
 * File Created at 2019年4月6日
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package test.lesson3.tree.binarytree;

/**
 * @Type BinaryTree
 * @Desc
 * @author 52489
 * @date 2019年4月6日
 * @Version V1.0
 */
public class BinaryTree {

    TreeNode root;

    /**
     * @param 设置根节点
     */
    public void setRoot(TreeNode root) {
        this.root = root;
    }

    /**
     * @return the root
     */
    public TreeNode getRoot() {
        return root;
    }

    /**
     * 
     */
    public void frontShow() {
        root.frontShow();
    }

    public void midShow() {
        root.midShow();
    }

    public void afterShow() {
        root.afterShow();
    }

    public TreeNode frontSearch(int value) {

        return root.frontSearch(value);
    }

    /**
     * @param i
     */
    public void delete(int i) {
        if (root.value == i) {
            root = null;
        } else {
            root.delete(i);
        }

    }

}
